package com.sykj.cloud.system.api.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sykj.cloud.common.core.annotation.Excel;
import com.sykj.cloud.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

/**
 * 系统用户对象 sys_user
 *
 * @author mr.will
 * @date 2021-03-23
 */
public class SysUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    private String guid;

    /** 应用ID */
    @Excel(name = "应用ID")

    private String applicationId;

    /** 组织机构ID */
    @Excel(name = "组织机构ID")

    private String organizationId;

    /** 部门ID */
    @Excel(name = "部门ID")

    private String deptId;

    /** 姓名 */
    @Excel(name = "姓名")

    private String name;

    /** 简称 */
    @Excel(name = "简称")

    private String shortName;

    /** 登录名 */
    @Excel(name = "登录名")

    private String loginName;

    /** 登录密码 */
    @Excel(name = "登录密码")

    private String loginPassword;

    /** 邮箱 */
    @Excel(name = "邮箱")

    private String email;

    /** 手机 */
    @Excel(name = "手机")

    private String phone;

    /** 电话 */
    @Excel(name = "电话")

    private String tel;

    /** 传真 */
    @Excel(name = "传真")

    private String fax;

    /** 地址 */
    @Excel(name = "地址")

    private String address;

    /** 头像url */
    @Excel(name = "头像url")

    private String avatarUrl;

    /** 员工ID */
    @Excel(name = "员工ID")

    private String employeeId;

    /** 会员ID */
    @Excel(name = "会员ID")

    private String memberId;

    /** 性别 */
    @Excel(name = "性别")

    private Integer gender;

    /** 人员ID */
    @Excel(name = "人员ID")

    private String peopleId;

    /** 微信昵称 */
    @Excel(name = "微信昵称")

    private String weixinName;

    /** 微信ID */
    @Excel(name = "微信ID")

    private String weixinOpenId;

    /** 审批状态 */
    @Excel(name = "审批状态")

    private Integer approvedStatus;

    /** 审批人 */
    @Excel(name = "审批人")

    private String approvedUserId;

    /** 审批意见 */
    @Excel(name = "审批意见")

    private String approvedExplain;

    /** 审批时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date approvedTime;

    /** 最后登录时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastLoginTime;

    /** 最后登录IP */
    @Excel(name = "最后登录IP")

    private String lastLoginIp;

    /** 是否需要修改密码 */
    @Excel(name = "是否需要修改密码")

    private Integer needChangePw;

    /** 是否要审批 */
    @Excel(name = "是否要审批")

    private Integer needApprove;

    /** 是否有效 */
    @Excel(name = "是否有效")

    private Integer valid;

    /** 是否锁定 */
    @Excel(name = "是否锁定")

    private Integer lock;

    /** 是否已删除 */
    @Excel(name = "是否已删除")

    private Integer deleted;

    /** 删除人 */
    @Excel(name = "删除人")

    private String deleteBy;

    /** 删除时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date deleteTime;

    private OrgDept dept;

    /** 角色对象 */
    private List<SysRole> roles;

    /** 角色组 */
    private String[] roleIds;

    /** 岗位组 */
    private String[] postIds;

    public boolean isAdmin()
    {
        return isAdmin(this.guid);
    }

    public static boolean isAdmin(String userId)
    {
        return userId != null && "06e7ee2a975540b88600c10a99e6e399".equals(userId) ;
    }



    public List<SysRole> getRoles() {
        return roles;
    }

    public void setRoles(List<SysRole> roles) {
        this.roles = roles;
    }

    public String[] getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(String[] roleIds) {
        this.roleIds = roleIds;
    }

    public String[] getPostIds() {
        return postIds;
    }

    public void setPostIds(String[] postIds) {
        this.postIds = postIds;
    }

    public void setGuid(String guid)
    {
        this.guid = guid;
    }

    public String getGuid()
    {
        return guid;
    }
    public void setApplicationId(String applicationId)
    {
        this.applicationId = applicationId;
    }

    public String getApplicationId()
    {
        return applicationId;
    }
    public void setOrganizationId(String organizationId)
    {
        this.organizationId = organizationId;
    }

    public String getOrganizationId()
    {
        return organizationId;
    }
    public void setDeptId(String deptId)
    {
        this.deptId = deptId;
    }

    public String getDeptId()
    {
        return deptId;
    }
    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }
    public void setShortName(String shortName)
    {
        this.shortName = shortName;
    }

    public String getShortName()
    {
        return shortName;
    }
    public void setLoginName(String loginName)
    {
        this.loginName = loginName;
    }

    public String getLoginName()
    {
        return loginName;
    }
    public void setLoginPassword(String loginPassword)
    {
        this.loginPassword = loginPassword;
    }

    public String getLoginPassword()
    {
        return loginPassword;
    }
    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getEmail()
    {
        return email;
    }
    public void setPhone(String phone)
    {
        this.phone = phone;
    }

    public String getPhone()
    {
        return phone;
    }
    public void setTel(String tel)
    {
        this.tel = tel;
    }

    public String getTel()
    {
        return tel;
    }
    public void setFax(String fax)
    {
        this.fax = fax;
    }

    public String getFax()
    {
        return fax;
    }
    public void setAddress(String address)
    {
        this.address = address;
    }

    public String getAddress()
    {
        return address;
    }
    public void setAvatarUrl(String avatarUrl)
    {
        this.avatarUrl = avatarUrl;
    }

    public String getAvatarUrl()
    {
        return avatarUrl;
    }
    public void setEmployeeId(String employeeId)
    {
        this.employeeId = employeeId;
    }

    public String getEmployeeId()
    {
        return employeeId;
    }
    public void setMemberId(String memberId)
    {
        this.memberId = memberId;
    }

    public String getMemberId()
    {
        return memberId;
    }
    public void setGender(Integer gender)
    {
        this.gender = gender;
    }

    public Integer getGender()
    {
        return gender;
    }
    public void setPeopleId(String peopleId)
    {
        this.peopleId = peopleId;
    }

    public String getPeopleId()
    {
        return peopleId;
    }
    public void setWeixinName(String weixinName)
    {
        this.weixinName = weixinName;
    }

    public String getWeixinName()
    {
        return weixinName;
    }
    public void setWeixinOpenId(String weixinOpenId)
    {
        this.weixinOpenId = weixinOpenId;
    }

    public String getWeixinOpenId()
    {
        return weixinOpenId;
    }
    public void setApprovedStatus(Integer approvedStatus)
    {
        this.approvedStatus = approvedStatus;
    }

    public Integer getApprovedStatus()
    {
        return approvedStatus;
    }
    public void setApprovedUserId(String approvedUserId)
    {
        this.approvedUserId = approvedUserId;
    }

    public String getApprovedUserId()
    {
        return approvedUserId;
    }
    public void setApprovedExplain(String approvedExplain)
    {
        this.approvedExplain = approvedExplain;
    }

    public String getApprovedExplain()
    {
        return approvedExplain;
    }
    public void setApprovedTime(Date approvedTime)
    {
        this.approvedTime = approvedTime;
    }

    public Date getApprovedTime()
    {
        return approvedTime;
    }
    public void setLastLoginTime(Date lastLoginTime)
    {
        this.lastLoginTime = lastLoginTime;
    }

    public Date getLastLoginTime()
    {
        return lastLoginTime;
    }
    public void setLastLoginIp(String lastLoginIp)
    {
        this.lastLoginIp = lastLoginIp;
    }

    public String getLastLoginIp()
    {
        return lastLoginIp;
    }
    public void setNeedChangePw(Integer needChangePw)
    {
        this.needChangePw = needChangePw;
    }

    public Integer getNeedChangePw()
    {
        return needChangePw;
    }
    public void setNeedApprove(Integer needApprove)
    {
        this.needApprove = needApprove;
    }

    public Integer getNeedApprove()
    {
        return needApprove;
    }
    public void setValid(Integer valid)
    {
        this.valid = valid;
    }

    public Integer getValid()
    {
        return valid;
    }
    public void setLock(Integer lock)
    {
        this.lock = lock;
    }

    public Integer getLock()
    {
        return lock;
    }
    public void setDeleted(Integer deleted)
    {
        this.deleted = deleted;
    }

    public Integer getDeleted()
    {
        return deleted;
    }
    public void setDeleteBy(String deleteBy)
    {
        this.deleteBy = deleteBy;
    }

    public String getDeleteBy()
    {
        return deleteBy;
    }
    public void setDeleteTime(Date deleteTime)
    {
        this.deleteTime = deleteTime;
    }

    public Date getDeleteTime()
    {
        return deleteTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("guid", getGuid())
            .append("applicationId", getApplicationId())
            .append("organizationId", getOrganizationId())
            .append("deptId", getDeptId())
            .append("name", getName())
            .append("shortName", getShortName())
            .append("loginName", getLoginName())
            .append("loginPassword", getLoginPassword())
            .append("email", getEmail())
            .append("phone", getPhone())
            .append("tel", getTel())
            .append("fax", getFax())
            .append("address", getAddress())
            .append("avatarUrl", getAvatarUrl())
            .append("employeeId", getEmployeeId())
            .append("memberId", getMemberId())
            .append("gender", getGender())
            .append("peopleId", getPeopleId())
            .append("weixinName", getWeixinName())
            .append("weixinOpenId", getWeixinOpenId())
            .append("approvedStatus", getApprovedStatus())
            .append("approvedUserId", getApprovedUserId())
            .append("approvedExplain", getApprovedExplain())
            .append("approvedTime", getApprovedTime())
            .append("lastLoginTime", getLastLoginTime())
            .append("lastLoginIp", getLastLoginIp())
            .append("needChangePw", getNeedChangePw())
            .append("needApprove", getNeedApprove())
            .append("valid", getValid())
            .append("lock", getLock())
            .append("deleted", getDeleted())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("deleteBy", getDeleteBy())
            .append("deleteTime", getDeleteTime())
            .append("remark", getRemark())
            .toString();
    }
}
